<template>
  <div>
    <footer class="footer">
      <span class="todo-count"><strong>{{shengyucounts}}</strong>剩余</span>
      <ul class="filters" @click="$emit('changetype', type)">
        <li>
          <a :class="{selected:type==='all'}" href="#/" @click="type='all'">全部</a>
        </li>
        <li>
          <a href="#/active" :class="{selected:type==='active'}" @click="type='active'">进行中</a>
        </li>
        <li>
          <a href="#/completed" :class="{selected:type==='completed'}" @click="type='completed'">已完成</a>
        </li>
      </ul>
      <button class="clear-completed" @click="clear">清除已完成</button>
    </footer>
  </div>
</template>

<script>
export default {
  name: 'Vuetodo2TodoFooter',
  props: {
    list: {
      type: Array,
      required: true,
    },
    type:{
      type:String,
      required:true
    }
  },
  props:["list","type"],
  data() {
    return {
      
    };
  },
  computed:{
    shengyucounts(){
      return this.list.filter(item=>item.isDone===false).length 
    }
  },

  mounted() {
    
  },

  methods: {
    clear(){
      this.$emit('clear');
    },
  },
};
</script>

<style lang="scss" scoped>

</style>